package com.x.mygulimall5.search.po;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Document(indexName = "skuinfo", type = "docs")//应用启动自动创建此索引
public class SkuInfo implements Serializable {
    //商品id，同时也是商品编号
    @Id
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Long id;

    //SKU名称

    /**
     * type = FieldType.Text 类型 Text支持分词
     * index = true 添加数据的时候 是否分词
     * analyzer = "ik_smart" 分词的时候 所使用的分词器
     * store = true 是否存储
     * searchAnalyzer = "ik_smart" 搜索的时候使用
     */
    @Field(index = true, store = true, type = FieldType.Text, analyzer = "ik_smart",searchAnalyzer = "ik_smart")
    private String name;
}
